home *** CD-ROM | disk | FTP | other *** search
/ The Very Best of Atari Inside / The Very Best of Atari Inside 1.iso / sharew / elektro / cla / vhdl / readme < prev    next >
Encoding:
Text File  |  1993-12-05  |  10.1 KB  |  332 lines

  1. CLA-VHDL Compiler v1.0ßeta
  2. (Part of the CLA version 2 release 1 package)
  3.  
  4. Preliminary Release Documentation                                  2/11/93
  5. ==========================================================================
  6. Preface
  7. -------
  8.  
  9. VHDL is a derivative of ADA which is aimed at systems modelling and
  10. ASIC/FPGA/EPLD design.
  11.  
  12. This documentation is NOT a guide to VHDL. There are many
  13. good books on this subject. This document just lays out the
  14. language features which can be handled.
  15.  
  16. This program (CLAVHDL.PRG) provides a compiler to produce
  17. CLA blocks from VHDL (VHSIC High-level Design Language) entities.
  18.  
  19.  However, the subset of VHDL which is supported is quite 
  20. straightforward to understand, so there should be few
  21. problems.....
  22.  
  23. NOTE: This is also not really very good documentation for CLA-VHDL either.
  24.         Tough. The program is quite easy to use though, and I am available
  25.         via EMAIL or land-mail if you get stuck. Registering will sort you
  26.         out good & proper though (I'll answer your questions then).
  27.  
  28. ==========================================================================
  29. ABOUT THE AUTHOR
  30. ----------------
  31. I am not rich. I am poor. Register - it may help.
  32.  
  33.     CRAIG GRAHAM
  34.     46 School Rd,
  35.     Langold,
  36.     Worksop,
  37.     Notts,
  38.     S81 9PY.
  39.     ENGLAND.
  40.  
  41. EMAIL: craig.graham@newcastle.ac.uk
  42.  
  43. Copyright
  44. ---------
  45. This program is mine.
  46. I wrote it.
  47. You may use it, but not modify it.
  48. It will be still mine though......
  49.  
  50. ==========================================================================
  51. Restrictions From Standard VHDL
  52. -------------------------------
  53. Before you get your hopes up to much, this is a VERY clipped
  54. implementation of VHDL. Basically, it only supports data-flow
  55. modelling via concurent assignment statements of the form
  56.  
  57.     {signal} <= {boolean};
  58.  
  59. Other main restrictions are as follow
  60.  
  61. - Number of permitted entities per file = one
  62. - Number of architectures you may have for each entity = one
  63. - Allowable Data Types - bit.
  64. - No records, or arrays.
  65.  
  66. Ok, I said it was a very limited VHDL compiler. The reasons for
  67. it existing at all are
  68.  
  69.     a) To allow me to produce a standard 7400 library quickly
  70.         without farting about with schematics.
  71.     b) To let you produce small blocks as boolean equations
  72.         safe in the knowledge that the block definition will
  73.         be portable to another platform or design tool.
  74.     c) Do you know how much a VHDL system will set you back?
  75.         Model Technology, Mentor Graphics & Intergraph all
  76.         sell their products (which admitedly are years ahead
  77.         of this little toy) for VERY large sums - Intergraph's
  78.         system will set you back in excess of 30,000 pounds
  79.         (UK) + 20K per year maintenance! Ouch....
  80.  
  81. If I get enough feedback on this, I will extend it, otherwise development
  82. is frozen (for now).
  83.  
  84. NOTE: Although the files generated by this program have a .NET extension,
  85.       they are not intended to be LOADED by CLA, they are intended to be
  86.       MERGED. In fact, they will NOT load at all. Attempting to simply
  87.       load one of these files may result in CLA crashing.
  88.  
  89. ==========================================================================
  90. Language Definition.
  91. --------------------
  92.  
  93. Having depressed you with what cann't be done, here's what CAN
  94. be done....and how.
  95.  
  96. 1) Structure
  97. ------------
  98. Each VHDL file will start with an ENTITY header. This defines the
  99. blocks interface to the outside world. You put any port declairations
  100. you require here.
  101.  
  102. An entity can be thought of as either a block in a schematic (this is
  103. the view you should take when dealing with this release of CLA-VHDL, as
  104. you cann't access other entities from the VHDL at present), or as a
  105. procedure in a program (if you want to go on to produce whole designs
  106. in VHDL without any schematics at all-better buy a proper (ie expensive)
  107. VHDL compiler to do that though).
  108.  
  109. Format:
  110.  
  111.     ENTITY {name} IS
  112.         PORT( {port list} );
  113.     END {name};
  114.     
  115. Where    
  116.     {port list} = {port name}:{port direction} {port size}; {port list}
  117.     {port direction} = in | out
  118.     {port size} = BIT   (for now at least)
  119.  
  120. Example.
  121.  
  122.     ENTITY test IS
  123.         PORT(i1:IN BIT; i2:IN BIT;
  124.              o1:OUT bit; o2:OUT BIT;
  125.             );
  126.     END test;
  127.  
  128. The above code fragment declares an ENTITY called test. The resulting block
  129. will be named after the entity, so in this CASE a block called TEST IS
  130. produced. It has two inputs (i1 & i2) and two outputs (o1 & o2).
  131.  
  132. Now the good news.....if you don't have your VHDL written elsewhere, the
  133. graphical version of CLA-VHDL will write this section for you, from the
  134. block outline you gave it. So you don't really have to worry about this
  135. too much. (NOTE: This feature is available on the REGISTERED user's
  136. version of the compiler, not in this one).
  137.  
  138. The next section contains the actual definition of what the entity actually
  139. is. This is where the majority of your coding effort will be.
  140.  
  141. The format of the ARCHITECTURE section is as follows :
  142.  
  143.     ARCHITECTURE {arch. name} OF {entity name} IS
  144.         {signal definitions}
  145.     BEGIN
  146.         {code}
  147.     END;
  148.  
  149. Look familiar? No? Don't worry. In this implementation, as you can only have
  150. one architecture for a given entity, the {arch. name} field is fairly
  151. irrelevant. But you must put it in (call it anything you like) for
  152. compatibility with other (better) VHDL implementations.
  153.  
  154. The Signal definitions are like variables inside the entity - they are not 
  155. visible outside like ports are. You can think of them as like wires on a
  156. circuit board, as you can use them to carry signals around.
  157.  
  158.  They are declared as follows:
  159.  
  160.     SIGNAL {signal name}:{port size};
  161.  
  162. Easy...
  163.  
  164. Here is an example of an architecture for our TEST example:
  165.  
  166.     ARCHITECTURE dataflow OF test IS
  167.         SIGNAL a:BIT; b:BIT;
  168.         SIGNAL c:BIT;
  169.     BEGIN
  170.     END;
  171.  
  172. As you can see, there are 3 internal signals (a,b & c).
  173. Notice that no mention is made of the external ports - they are not
  174. defined here, they are done in the entity header.
  175.  
  176. ==========================================================================
  177. 2) Assignment statements.
  178. -------------------------
  179.  
  180. An entity's behaviour is defined in this version of VHDL as a series of
  181. CONCURRENT ASSIGNMENT statements.
  182.  
  183.  This technique is known as DATAFLOW modelling. Better VHDL implementations 
  184. allow more freedom in expressing things than this.
  185.  
  186. The form of the statement is:
  187.  
  188.      {signal} <= {boolean equation};
  189.               |
  190.               +-------Assignment operator.
  191.               
  192. Where a signal is either an internal signal or an output port.
  193. A boolean equation is and combination of signals and boolean operators.
  194.  
  195.     VALID BOOLEAN OPERATIONS
  196.     ------------------------
  197.     AND
  198.     NAND
  199.     OR
  200.     NOR
  201.     XOR
  202.     NOT
  203.  
  204. For example, in our earlier example, we could fill in the ARCHITECTURE body
  205. as follows:
  206.  
  207.     ARCHITECTURE structure OF test IS
  208.         SIGNAL a:BIT; b:BIT;
  209.         SIGNAL c:BIT;
  210.     BEGIN
  211.         a<=i1;
  212.         b<=i2;
  213.         o1<=NOT a;
  214.         o2<=b AND i2;
  215.         o3<=i1 OR i2;
  216.     END;
  217.  
  218. More complex equations may be formed using parentheses:
  219.  
  220.     a<=(a AND not b) OR (b and not a);
  221.  
  222. actually, though this is a valid equation, the brackets are redundant,
  223. so you could also write:
  224.  
  225.     a<=a AND not b OR b AND not a;
  226.  
  227. As in other languages (such as BASIC), this works due to operator precedance
  228. (AND is processed before OR, & NOT comes before them all).
  229.  
  230. NOTE: Although this VHDL compiler supports operator precedance, some don't
  231.     (eg. the Intergraph simulator), so from a portability point of view, you
  232.     should write the above line as:
  233.  
  234.     a<=(a AND not b) OR (b AND not a);
  235.  
  236.     Or even:
  237.  
  238.     a<=(a AND (not b)) OR (b AND (not a));
  239.  
  240. The CONCURRENT ASSIGNMENT title comes because, unlike Pascal, where if you
  241. wrote:
  242.  
  243.     a:=a AND not B OR c;
  244.     b:=d;
  245.  
  246. then 'a' would be assigned then 'b' in sequence, VHDL signal assignments occur
  247. in parallel. 
  248. So 'a' may well get the value required before 'b' is assigned, but equally, it
  249. may not, as both assignments were made at the same time. This makes the signal
  250. assignments non-deterministic (wow - thats a good word). Also, the assignments
  251. continue all the time the simulation is active, so they better model what would
  252. be happening in an electronic circuit.
  253.  
  254. CAUTION
  255. -------
  256.  
  257. Do NOT make multiple assignments to a signal or an output port. Although as many
  258. reads from a signal/input can be made as you wish, you must only assign to any
  259. given signal ONCE. All designers should know this anyway, but for those of you
  260. just starting on that long road to enlightenment, this causes CONTENTION, where
  261. one thing may try to force a 1 on a signal at the same time as another is
  262. trying to force a 0.
  263.  
  264. ==========================================================================
  265. 3) Comments
  266. ------------
  267.  
  268. Any lines which begin with -- are comment lines, and as such are ignored
  269. by the compiler.
  270.  
  271. eg)
  272.     -- TEST : An irrelevant and dull VHDL code snippet
  273.     --        for the masses.
  274.  
  275. ==========================================================================
  276. 4) TEST in full.
  277. ----------------
  278.  
  279. Here is the TEST entity example in full:
  280.  
  281.     -- TEST : An irrelevant and dull VHDL code snippet
  282.     --        for the masses.
  283.     --------------------------------------------------
  284.     ENTITY test IS
  285.         PORT(i1:IN BIT; i2:IN BIT;
  286.              o1:OUT bit; o2:OUT BIT;
  287.             );
  288.     END test;
  289.  
  290.     ARCHITECTURE structure OF test IS
  291.         SIGNAL a:BIT; b:BIT;
  292.         SIGNAL c:BIT;
  293.     BEGIN
  294.         a<=i1;
  295.         b<=i2;
  296.         o1<=NOT a;
  297.         o2<=b AND i2;
  298.         o3<=i1 OR i2;
  299.     END;
  300.  
  301. ==========================================================================
  302. 5) A Proper Example
  303. -------------------
  304. Below is the full code for a simple IC from CLA's 74xx library. Note that Vcc
  305. and GND are only included in the port header for completeness in the resulting
  306. block representation of the chip, and are not actually used.
  307.  
  308.     -- VHDL Model of an LS7400
  309.     --  CLA LIBRARY:7400
  310.     --  Written 4/9/93 by Craig Graham
  311.     -------------------------------------------
  312.     ENTITY LS7400 IS
  313.         PORT(a1:in bit; b1:in bit; o1:out bit;
  314.              a2:in bit; b2:in bit; o2:out bit;
  315.              gnd:in bit;
  316.              vcc:in bit;
  317.              a3:in bit; b3:in bit; o3:out bit;
  318.              a4:in bit; b4:in bit; o4:out bit;
  319.             );
  320.     END LS7400;
  321.  
  322.     ARCHITECTURE dataflow OF ls7400 is
  323.     begin
  324.         o1<=a1 nand b1;
  325.         o2<=a2 nand b2;
  326.         o3<=a3 nand b3;
  327.         o4<=a4 nand b4;
  328.     end;
  329.  
  330. There, easy isn't it.....
  331.  
  332.